<template>
  <div>
    <r-search
      :searchForm="searchForm"
      :searchHandle="searchHandle"
      :searchData="searchData"
    />
    <r-table
      :isPagination="true"
      :tableData="tableData"
      :tableCols="tableCols"
      :tablePage="tablePage"
      @refresh="init()"
    ></r-table>
    <!-- <r-form :formRules="formRules" :formHandle="formHandle" :formData="formData" :formCols="formCols" ref="elForm" labelWidth="100px" dialogWidth="500px" :isHandle="true" /> -->
  </div>
</template>
<script>
export default {
  data() {
    return {
      searchData: {
        sType: "2"
      },
      searchForm: [
        {
          type: "input",
          prop: "number",
          placeholder: "Order Nnumber",
          width: 150
        },
        {
          type: "input",
          prop: "name",
          placeholder: "下单User",
          width: 150
        },
        {
          type: "select",
          prop: "state",
          placeholder: "订单Status",
          width: 150,
          options: [
            {
              label: "Review Pass",
              value: "1"
            },
            {
              label: "审核不Pass",
              value: "2"
            },
            {
              label: "Pending Review",
              value: "3"
            }
          ]
        },
        {
          type: "date",
          prop: "etime",
          placeholder: "Submission Time",
          width: 170,
          options: []
        }
      ],
      searchHandle: [
        {
          label: "Search",
          type: "success",
          icon: "el-icon-search",
          handle: e => this.init()
        },
        {
          label: "Reset",
          icon: "el-icon-refresh-right",
          handle: e => this.searchFromReset()
        }
      ],
      tableData: [],
      tableCols: [
        {
          label: "Order Nnumber",
          prop: "number"
          // theme: e => e.status ? 'primary' : 'danger', type: "tag",
        },
        {
          label: "Submission Time",
          prop: "createdTime"
        },
        {
          label: "Username",
          prop: "name"
        },
        {
          label: "Phone码",
          prop: "phone"
        },
        {
          label: "Withdrawal Amount",
          prop: "money"
        },
        {
          label: "到账方式",
          prop: "type",
          formatter: e =>
            e.type == 1
              ? "银行卡"
              : e.type == 2
              ? "WeChat"
              : e.type == 3
              ? "Alipay"
              : ""
        },
        {
          label: "账户资料",
          prop: "bankInfo",
          formatter: e => e.bankInfo && JSON.parse(e.bankInfo).bankCard
        },
        {
          label: "订单Status",
          prop: "state",
          formatter: e =>
            e.state == 1
              ? "Review Pass"
              : e.state == 2
              ? "审核不Pass"
              : "Pending Review"
        }
      ],
      tablePage: { limit: 10, page: 1, total: 0 }
    };
  },
  components: {},
  computed: {},
  mounted() {
    this.init();
  },
  methods: {
    async init() {
      let param = { ...this.searchData, ...this.tablePage };
      let res = await this.api.takecashList(param);
      if (res) {
        this.tablePage.total = res.data.total;
        this.tableData = res.data.list;
      }
    },
    //查询
    elFormSubmit() {},
    goDetail() {
      this.$router.push("/saleServe-Detail");
    }
  }
};
</script>
<style scoped lang="scss">
.el-icon-search {
  margin-right: 10px;
}
</style>
